/**
 * 零基础学C语言
 * 
 * version: 1st
 * author: 明日科技
 * http://www.mingrisoft.com
 */

#include <stdio.h>

void swap(int *a, int *b) {
    int temp = *a;
    *a = *b;
    *b = temp;
}

int main() {
    int x = 1, y = 9;
    printf("交换数据前：x = %d, y = %d\n", x, y);
    swap(&x, &y);
    printf("交换数据后：x = %d, y = %d\n", x, y);

    return 0;
}

/*
output:
交换数据前：x = 1, y = 9
交换数据后：x = 9, y = 1
*/